namespace Pdf
{
	inline StreamInfo::StreamInfo() 
		: length(0), checksum( 16, 0 )
	{	}

	inline StreamInfo::StreamInfo(unsigned long length, const std::vector<char> &checksum) 
		: length(length), checksum(checksum)
	{	}

	inline bool StreamInfo::operator == (const Pdf::StreamInfo &rhs) const
	{	return length == rhs.length && memcmp( &checksum[0], &rhs.checksum[0], 16 ) == 0;	}

	inline bool StreamInfo::operator < (const Pdf::StreamInfo &rhs) const
	{	return length == rhs.length ? length < rhs.length : memcmp( &checksum[0], &rhs.checksum[0], 16 ) < 0;	}

	// =====================================================================

	inline bool FontInfo::operator ==(const Pdf::FontInfo &rhs) const
	{
		if (name != rhs.name || encoding != rhs.encoding)
			return false;

		if ( widths.empty() || rhs.widths.empty() || widths.size() != rhs.widths.size() )
			return false;

		return memcmp( &widths[0], &rhs.widths[0], widths.size() * sizeof(int) ) == 0;
	}

	inline bool FontInfo::operator < (const Pdf::FontInfo &rhs) const
	{
		if ( name != rhs.name )
			return name < rhs.name;

		if ( encoding != rhs.encoding )
			return encoding < rhs.encoding;

		if ( widths.empty() || rhs.widths.empty() || widths.size() != rhs.widths.size() )
			return widths.size() < rhs.widths.size();

		return memcmp( &widths[0], &rhs.widths[0], widths.size() * sizeof(int) ) < 0;
	}
}